﻿@model QzgfFrame.System.DepartmentManger.Models.SystemDepartment
        
@{
    ViewBag.Title = "Register";
}

@using (Html.BeginForm("edit", "department", FormMethod.Post, new { name = "form1", id = "form1" }))
{
    @Html.HiddenFor(m=>m.Id)
    @Html.ValidationSummary(true, "Account creation was unsuccessful. Please correct the errors and try again.")
       <div>
        <table cellpadding="0" border="0" cellspacing="0" class="edittable">
            <tbody>
                <tr>
                    <td align="right" class="editcellmessage">部门名称:</td>
                    <td align="right" class="editcellverify"><div class="l-verify-star">*</div></td>
                    <td align="left" class="editcell">
                    @Html.TextBoxFor(m => m.Departname, new { validate = "{required:true,minlength:1}", ltype ="text" })
                    </td>
                </tr>
                <tr>
                    <td align="right" class="editcellmessage">负责人:</td>
                    <td align="right" class="editcellverify"><div class="l-verify-star"></div></td>
                    <td align="left" class="editcell">
                    @Html.TextBoxFor(m => m.Charger, new { ltype = "text" })
                    </td> 
                </tr> 
                <tr>
                    <td align="right" class="editcellmessage">负责人电话:</td>
                    <td align="right" class="editcellverify"><div class="l-verify-star"></div></td>
                    <td align="left" class="editcell">
                    @Html.TextBoxFor(m => m.Tel, new { validate = "{cellphone:true}", ltype = "text" })
                    </td> 
                </tr>
                <tr>
                    <td align="right" class="editcellmessage">负责人地址</td>
                    <td align="right" class="editcellverify"><div class="l-verify-star"></div></td>
                    <td align="left" class="editcell">
                     @Html.TextBoxFor(m => m.Address, new { ltype = "text" })
                    </td> 
                </tr>
                <tr>
                    <td align="right" class="editcellmessage">上级结点：</td>
                    <td align="right" class="editcellverify"><div class="l-verify-star">*</div></td>
                    <td align="left" class="editcell">
                     @Html.TextBoxFor(m => m.Fathername, new { validate = "{required:true,minlength:1}", ltype = "text" })
                     @Html.HiddenFor(m => m.Father)
                    </td>
                </tr>
                <tr>
                    <td align="right" class="editcellmessage">备注：</td>
                    <td align="right" class="editcellverify"><div class="l-verify-star"></div></td>
                    <td align="left" class="editcell">
                    @Html.TextAreaFor(m => m.Remark, new {ltype = "text" })
                    </td>
                </tr>
                <tr>
                <td>

                </td>
                </tr>
            </tbody>
        </table>
    </div> 
    }
    <script src="@Url.Content("~/Lib/jquery-validation/jquery.validate.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Lib/jquery-validation/messages_cn.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Lib/jquery-validation/jquery.metadata.js")" type="text/javascript"></script>
    <script type="text/javascript">
        //var CurID =  <%=CurID %>;
        var Validator = null;
        $(function () {
            $.metadata.setType("attr", "validate");
            //处理下拉框
            $("#Fathername").ligerComboBox({
                selectBoxWidth: 200, treeLeafOnly: false,
                selectBoxHeight: 150, valueFieldID: 'Father', textFieldID: 'Fathername',
                tree: { url: '/system/department/getfather', checkbox: false, topParentIDValue: -1, idFieldName: 'id', parentIDFieldName: 'pid' }
            });
           
            
            $("#form1").ligerForm();
            deafultValidate($("#form1"));
            Validator = $("#form1").validate();
            debugger;
        });

        function f_success() {
            $(document).ready(function () {
                $.ligerDialog.confirm("是否继续编辑", "保存成功", function (ok) {
                    $.ligerDialog.closeWaitting();
                    parent.window.frames["mainframe"].f_reload();
                    if (!ok) {
                        parent.window.frames["mainframe"].f_closeWindow();
                    }
                });
            });
        }
        function f_error(message) {
            $(document).ready(function () {
                $.ligerDialog.error(message);
            });
        }
        function f_save() {
            if(!Validator.form()) return;
            $.ligerDialog.waitting("正在保存中...");
            //提交数据
            document.forms[0].submit();
        } 
    </script>
     <style type="text/css">
        .edittable .editcellmessage,.edittable .editcellverify,.edittable .editcell{ padding:4px;line-height:23px;}
        .edittable .editcellmessage{ padding-left:20px;} 
        body { font-size:12px; background:white;}
        /*出现边框效果
        fieldset {
            padding:10px;
            margin:10px;
            color:#333; 
            border:#06c dashed 1px;
        } 
        legend {
            color:#06c;
            font-weight:800; 
            background:#fff;
        }*/
    </style>
